package com.qianxx.component.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.component.activity.menu.app_dock.AppDockActivity;
import com.qianxx.component.activity.menu.drag_layout.DragLayoutActivity;
import com.qianxx.component.activity.menu.drawer_layout.DrawerLayoutActivity;
import com.qianxx.component.activity.menu.satellite_menu.SatelliteMenuActivity;
import com.qianxx.component.activity.menu.slide_menu.SlideMenuActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;

public class MenuActivity extends BaseActivity {

    @BindView(R.id.lv)
    ListView lv;
    private ArrayAdapter adapter;
    private String[] listItems = {"SlideMenu", "DragLayout", "DrawerLayout",
            "SatelliteMenu", "AppDock"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);
        ButterKnife.bind(this);

        adapter = new ArrayAdapter(this, R.layout.item, listItems);
        lv.setAdapter(adapter);
    }

    @OnItemClick(R.id.lv)
    void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        Class cls = null;
        switch (arg2) {
            case 0:
                cls = SlideMenuActivity.class;
                break;
            case 1:
                cls = DragLayoutActivity.class;
                break;
            case 2:
                cls = DrawerLayoutActivity.class;
                break;
            case 3:
                cls = SatelliteMenuActivity.class;
                break;
            case 4:
                cls = AppDockActivity.class;
                break;
            default:
                break;
        }
        Intent intent = new Intent(this, cls);
        startActivity(intent);
    }

    @Override
    public String setTitle() {
        return "菜单类";
    }
}
